#include <QApplication>
#include <QTextCodec>
#include <QFontDatabase>
#include <QtDebug>
#include <QDesktopWidget>
#include "./view/mainwindow.h"

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

	QTextCodec *codec = QTextCodec::codecForName("UTF-8");
	QTextCodec::setCodecForTr(codec);
	QTextCodec::setCodecForLocale(codec);
	QTextCodec::setCodecForCStrings(codec);


    int fontId = -1;
#ifdef __linux
    fontId = QFontDatabase::addApplicationFont("./font/SourceHanSansCN-Normal.otf");
#else
    fontId = QFontDatabase::addApplicationFont("SourceHanSansCN-Normal.otf");
#endif
    if (fontId >= 0) {
        QString fontFamily = QFontDatabase::applicationFontFamilies(fontId).at(0);
        qDebug() << "font-family:" << fontFamily;
        QFont font(fontFamily);
        QApplication::setFont(font);
    } else {
        qWarning() << "font load failed!";
    }

    MainWindow osd;
	osd.show();

    osd.loadSchedule();

    return app.exec();
}
